<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
    <title>创建模版</title>
    <link rel="stylesheet" href="/style/weui.css"/>
    <link rel="stylesheet" href="/style/swiper.min.css"/>
    <link rel="stylesheet" href="/style/example.css"/>
    <link rel="stylesheet" href="/style/jquery-weui.css">
    <link rel="stylesheet" href="/style/sweetalert.css"/>
</head>
<body ontouchstart>
<div class="page">
    <div class="page__bd" style="height: 100%;">
        <div class="weui-tab">
            <div class="header">
                <div class="navbar-box">
                    <h3 style="color: #eee; text-align: center; width: 100%;line-height: 45px">创建模版</h3>
                </div>
            </div>
            <div class="weui-tab__bd" style="padding-top: 45px;">
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">选择门店:</label></div>
                    <div class="weui-cell__bd">
                        <input id="tempId" type="hidden" value="<?=$tempData?$tempData['tempId']:'' ?>">
                        <input class="weui-input" id="shop" type="text" value="<?=$tempData?$tempData['shopName']:'' ?>" data-values="<?=$tempData?$tempData['shopId']:'' ?>" readonly="">
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">模版名称:</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="text" id="tempName" value="<?=$tempData?$tempData['tempName']:'' ?>">
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">备注:</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="text" id="remark" value="<?=$tempData?$tempData['remark']:'' ?>">
                    </div>
                </div>
            </div>
            <div class="weui-form-preview__ft weui-footer_fixed-bottom" style="background-color: #fff; bottom: 0">
                <a class="weui-form-preview__btn" href="/inventory/template-list">返回</a>
                <a class="weui-form-preview__btn weui-form-preview__btn_primary" href="javascript:tempNext()">下一步</a>
            </div>
        </div>
    </div>
</div>
<script src="/js/zepto.min.js"></script>
<script src="/js/sweetalert.min.js"></script>
<script src="/js/swiper.min.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
<script src="/js/swiper.min.js"></script>
<script src="/js/jquery-weui.js"></script>
<script>

    $("#shop").select({
        title: "选择门店",
        items: <?=json_encode($shopArr)?>
    });

    function tempNext() {
        var tempId = $('#tempId').val();
        var shopId = $('#shop').attr('data-values');
        var shopName = $('#shop').val();
        var tempName = $('#tempName').val();
        if (!shopId) {
            swal('请选择门店');
            return;
        }
        if ($.trim(tempName) == '') {
            swal('请输入模版名称');
            return;
        }

        location.href = '/inventory/template-data?tempId='+ tempId +'&shopId=' + shopId + '&shopName=' + shopName + '&tempName=' + tempName + '&remark=' + $('#remark').val()+'&editFlg=1';
    }
</script>
</body>
</html>
